package com.k.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.k.demo.entity.ConstantTermKind;
import com.k.demo.entity.Notice;

@Mapper
public interface ConstantTermKindMapper {
	
	//查找全部常数项类别
	@Select("select * from constant_term_kind where is_delete=1")
	List<ConstantTermKind> getAll();
	
	//根据Id查找
	@Select("select * from constant_term_kind where is_delete=1 and constant_term_kind_id = #{constant_term_kind_id}")
	ConstantTermKind getById(int constant_term_kind_id);
	
	//真删除
	@Delete("delete from constant_term_kind where constant_term_kind_id = #{constant_term_kind_id}")
	int trueDeleteById(int constant_term_kind_id);
	
	//假删除
	@Update("update constant_term_kind set is_delete=0 where constant_term_kind_id = #{constant_term_kind_id}")
	int falseDeleteById(int constant_term_kind_id);
	
	//批量删除
	boolean  deleteByGroup(List<Integer> list);
	
	//插入(新增)
	int insertCTK(ConstantTermKind constantTermKind);
	
	//修改
	int modifyCTK(ConstantTermKind constantTermKind);
	
	//根据常数项名查询
	/*
	 * @Select("select * from constant_term_kind where instr(constant_term_kind_name,#{constant_term_kind_name})>0 and is_delete=1"
	 * )
	 */
	List<ConstantTermKind> selectByName(String constant_term_kind_name);
}
